<template>
	<view class="container">
		<view class="bg-colore"></view>
		<view class="content">
			<view class="wrap">
				<view class="">
					<view class="newslist" v-for="(item,index) in articleData" :key="item.articleId"
						@click="$public.navto('/pages/news/detail',{articleId:item.articleId})">
						<view class="title">
							{{item.title}}
						</view>
						<view class="remark">
							{{item.remark}}
						</view>
						<view class="bottom">
							<view class="time">
								{{item.postTime}}
							</view>
							<view class="">
								查看详情 >>
							</view>
						</view>

					</view>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				articleData: [],
				columnId: 0,
			};
		},
		onLoad(options) {
			if (options.columnId)
				this.columnId = options.columnId
		},
		onShow() {
			if (!this.$public.isLoginUrl())
				return false;
			else
				this.getArticle()
		},
		methods: {
			getArticle() {
				let that = this
				this.$public.htmlPost("/api/getArticle", {
					columnId: this.columnId
				}).then((res) => {
					// console.log("getArticle res", res)
					let data = res.data;
					if (data.code == 0) {
						that.articleData = data.data
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.content {
		// background: #fff;
		padding-top: 30rpx;

		.wrap {
			padding: $uni-wrap-padding;
		}

		.newslist {
			// display: flex;
			// justify-content: space-between;
			padding: 30rpx;
			border-bottom: 2rpx solid #f2f2f2;
			background: #fff;
			margin-bottom: 30rpx;
			border-radius: 16rpx 16rpx 16rpx 16rpx;

			.title {
				font-size: 32rpx;
				color: #333333;
				font-weight: bold;
			}

			.remark {
				font-size: 26rpx;
				color: #666666;
				line-height: 30rpx;
				display: -webkit-box;
				/* 将文本显示为块级盒子 */
				-webkit-line-clamp: 2;
				/* 最多显示两行文本 */
				-webkit-box-orient: vertical;
				/* 设置盒子内文本的垂直方向排列 */
				overflow: hidden;
				/* 隐藏溢出的文本 */
				text-overflow: ellipsis;
				/* 显示省略号 */
				padding: 16rpx 0;
				border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
			}

			.bottom {
				display: flex;
				justify-content: space-between;
				font-size: 26rpx;
				color: #666666;
				margin-top: 20rpx;
			}

		}
	}
</style>